﻿/* BDVB-App
Copyright (C) 2014 Sascha Manns <Sascha.Manns@outlook.de>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/


using HtmlAgilityPack;
using System;
using System.Collections.Generic;
using System.Text;

namespace AppStudio.Controls.Html2Xaml
{
	internal class TagDefinition
	{
		public TagDefinition()
		{
			this.Attributes = new Dictionary<string, string>();
		}

		public TagDefinition(string XamlTag)
			: this()
		{
			this.BeginXamlTag = XamlTag;
			this.EndXamlTag = string.Format(XamlTag, string.Empty).Replace("<", "</");
		}
		public TagDefinition(string XamlBeginTag, string XamlEndTag, bool MustBeTop = false)
			: this()
		{
			this.BeginXamlTag = XamlBeginTag;
			this.EndXamlTag = XamlEndTag;
			this.MustBeTop = MustBeTop;
		}
		public TagDefinition(Action<StringBuilder, HtmlNode> CustomAction)
			: this()
		{
			this.CustomAction = CustomAction;
			this.IsCustom = true;
		}
		public string BeginXamlTag { get; set; }
		public string EndXamlTag { get; set; }
		public Dictionary<string, string> Attributes { get; set; }
		public bool MustBeTop { get; set; }
		public bool IsCustom { get; set; }
		public Action<StringBuilder, HtmlNode> CustomAction { get; set; }
	}
}
